package baqroEnvir;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;

public class BigMacroNameAndBody {

		public void run(){
			testBigMacroNameAndBody();
		}
		
	   public void testBigMacroNameAndBody() {
	        StringBuffer name = new StringBuffer();
	        name.append("X");
	        for (int i = 0; i < 17; ++i)
	            name.append(name); // Make a quarter-megabyte string
	        String in = String.format("`#(%s)00{A%sB}`{%s}", name, name, name);
	        String out = String.format("A%sB", name);
	        runNoErrorTest(in, out);
	    }
	
	    private void runNoErrorTest(String input, String correctOutput) {
	        StringReader in = new StringReader(input);
	        FileWriter fileCreator = null;
			try {
				fileCreator = new FileWriter("C:/Users/Lucas/Documents/My Dropbox/Eclipse Workspace/CS351/src/baqroEnvir/file.txt");
			} catch (IOException e1) {
				e1.printStackTrace();
			}
	        PrintWriter out = new PrintWriter(fileCreator);
	        int c = -100;
	        try {
				c = in.read();
			} catch (IOException e) {
				e.printStackTrace();
			}
	        while(c > 0){
	        	out.write((char)c);
	        	try {
					c = in.read();
				} catch (IOException e) {
					e.printStackTrace();
				}
	        }
	        out.close();
	    }
	    
	public static void main(String[] args) {
		BigMacroNameAndBody bd = new BigMacroNameAndBody();
		bd.run();
	}

}
